<html>
<head>
<link rel="stylesheet" type="text/css" href="pgtaglib.css" />

<script type="text/javascript">
function toggleFreeFormTag() {
	if (document.getElementById('addtag_droplist').value=="other") {
	document.getElementById('tag_type').value="foo";
	document.getElementById('freeform_tag').style.display="inline";
	document.getElementById('tag_type').style.color="#FF0000";		
	} else {
	document.getElementById('tag_type').value=document.getElementById('addtag_droplist').value;
	document.getElementById('freeform_tag').style.display="none";	
	}
}
</script>
</head>
<body>
<?php
require_once("config.php");
require_once("utils.php");

$item_id=$_GET["item_id"];
$db=new SQLite3($dbfilename);
$results=$db->query("SELECT * FROM item_t WHERE item_id='$item_id';");
$res = $results->fetchArray(SQLITE3_ASSOC);
$pfn = $res['pfn'];
$md5sum=$res['md5sum'];
echo "pfn=" . "<a href=\"$pfn\">" . $pfn . "</a><br> md5sum = " . $md5sum . "<br>";
?>
Currently set tags:
<?php show_all_tags($item_id,$dbfilename); //TODO ?>

<p>
Add more tags:
<form id="addtag" method="post" action="add_tag.php">
<input type="hidden" name="item_id" value="<?php echo $item_id;?>">
<select id="addtag_droplist">
<option value="title" onclick="toggleFreeFormTag();">title</option>
<option value="author" onclick="toggleFreeFormTag();">author</option>
<option value="publisher"onclick="toggleFreeFormTag();">publisher</option>
<option value="year"onclick="toggleFreeFormTag();">year</option>
<option value="tag" selected onclick="toggleFreeFormTag();">keyword</option>
<option value="other" onclick="toggleFreeFormTag();">free-form tag</option>
</select>
<div id="freeform_tag" style="display:none;">
Tag type: <input id="tag_type" name="tag_type" type="text" value="keyword"/>
</div>
<input id="tag_value" name="tag_value" type="text"/>
<input type="submit" value="add" />
</form>
</body>
</html>
